package cn.cs.service;

import cn.cs.mapper.RepairComplaintMapper;
import cn.cs.pojo.RepairComplaint;
import cn.cs.pojo.RepairComplaintNode;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class RepairComplaintService {

    @Resource
    private RepairComplaintMapper repairComplaintMapper;

    @RequestMapping(value = "/getRepairComplaintById", method = RequestMethod.POST)
    public RepairComplaint getRepairComplaintById(@RequestParam("id") String id) throws Exception{
        return repairComplaintMapper.getRepairComplaintById(id);
    }

    @RequestMapping(value = "/getRepairComplaintListByMap", method = RequestMethod.POST)
    public List<RepairComplaint> getRepairComplaintListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return repairComplaintMapper.getRepairComplaintListByMap(param);
    }

    @RequestMapping(value = "/getRepairComplaintCountByMap", method = RequestMethod.POST)
    public Integer getRepairComplaintCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return repairComplaintMapper.getRepairComplaintCountByMap(param);
    }

    @RequestMapping(value = "/addRepairComplaint", method = RequestMethod.POST)
    public Integer addRepairComplaint(@RequestBody RepairComplaint repairComplaint) throws Exception{
        return repairComplaintMapper.insertRepairComplaint(repairComplaint);
    }

    @RequestMapping(value = "/modifyRepairComplaint", method = RequestMethod.POST)
    public Integer modifyRepairComplaint(@RequestBody RepairComplaint repairComplaint) throws Exception{
        return repairComplaintMapper.updateRepairComplaint(repairComplaint);
    }

    @RequestMapping(value = "/deleteRepairComplaintById", method = RequestMethod.POST)
    public Integer deleteRepairComplaintById(@RequestParam("id") String id) throws Exception{
        return repairComplaintMapper.deleteRepairComplaintById(id);
    }

    @RequestMapping(value = "/getPersonByCode", method = RequestMethod.POST)
    public Map<String, Object> getPersonByCode(@RequestParam("code") String code) throws Exception{
        return repairComplaintMapper.getPersonByCode(code);
    }

    @RequestMapping(value = "/addRepairComplaintNode", method = RequestMethod.POST)
    public Integer addRepairComplaintNode(@RequestBody RepairComplaintNode repairComplaint) throws Exception{
        return repairComplaintMapper.insertRepairComplaintNode(repairComplaint);
    }

    @RequestMapping(value = "/getRepairComplaintNodeCountByMap", method = RequestMethod.POST)
    public Integer getRepairComplaintNodeCountByMap(@RequestBody Map<String, Object> param) throws Exception{
        return repairComplaintMapper.getRepairComplaintNodeCountByMap(param);
    }

    @RequestMapping(value = "/getRepairComplaintNodeListByMap", method = RequestMethod.POST)
    public List<RepairComplaintNode> getRepairComplaintNodeListByMap(@RequestBody Map<String, Object> param) throws Exception{
        return repairComplaintMapper.getRepairComplaintNodeListByMap(param);
    }


}
